# noinspection PyUnresolvedReferences
import typing
if typing.TYPE_CHECKING:
    from typing import *
    # noinspection PyUnresolvedReferences
    from enum import Enum
    from .vnxtp import *


def set_async_callback_exception_handler(handler: Callable[[AsyncDispatchException], None]):
    """
    set a customize exception handler for async callback in this module(pyd)
    \a handler should return True if it handles that exception,

    :note: If the return value of \a handler is not True, exception will be re-thrown.
    """
    ...


class AsyncDispatchException:
    what: str
    instance: object
    function_name: str


class TraderSpi():
    
    
    
    
    def OnDisconnected(self, session_id: int, reason: int)->None:
        ...
    def OnError(self, error_info: XTPRspInfoStruct)->None:
        ...
    def OnOrderEvent(self, order_info: XTPOrderInfo, error_info: XTPRspInfoStruct, session_id: int)->None:
        ...
    def OnTradeEvent(self, trade_info: XTPTradeReport, session_id: int)->None:
        ...
    def OnCancelOrderError(self, cancel_info: XTPOrderCancelInfo, error_info: XTPRspInfoStruct, session_id: int)->None:
        ...
    def OnQueryOrder(self, order_info: XTPOrderInfo, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->None:
        ...
    def OnQueryTrade(self, trade_info: XTPTradeReport, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->None:
        ...
    def OnQueryPosition(self, position: XTPQueryStkPositionRsp, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->None:
        ...
    def OnQueryAsset(self, asset: XTPQueryAssetRsp, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->None:
        ...
    def OnQueryStructuredFund(self, fund_info: XTPStructuredFundInfo, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->None:
        ...
    def OnQueryFundTransfer(self, fund_transfer_info: XTPFundTransferNotice, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->None:
        ...
    def OnFundTransfer(self, fund_transfer_info: XTPFundTransferNotice, error_info: XTPRspInfoStruct, session_id: int)->None:
        ...
    def OnQueryETF(self, etf_info: XTPQueryETFBaseRsp, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->None:
        ...
    def OnQueryETFBasket(self, etf_component_info: XTPQueryETFComponentRsp, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->None:
        ...
    def OnQueryIPOInfoList(self, ipo_info: XTPQueryIPOTickerRsp, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->None:
        ...
    def OnQueryIPOQuotaInfo(self, quota_info: XTPQueryIPOQuotaRsp, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->None:
        ...
    def OnQueryOptionAuctionInfo(self, option_info: XTPQueryOptionAuctionInfoRsp, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->None:
        ...
    def OnCreditCashRepay(self, cash_repay_info: XTPCrdCashRepayRsp, error_info: XTPRspInfoStruct, session_id: int)->None:
        ...
    def OnQueryCreditCashRepayInfo(self, cash_repay_info: XTPCrdCashRepayInfo, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->None:
        ...
    def OnQueryCreditFundInfo(self, fund_info: XTPCrdFundInfo, error_info: XTPRspInfoStruct, request_id: int, session_id: int)->None:
        ...
    def OnQueryCreditDebtInfo(self, debt_info: XTPCrdDebtInfo, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->None:
        ...
    def OnQueryCreditTickerDebtInfo(self, debt_info: XTPCrdDebtStockInfo, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->None:
        ...
    def OnQueryCreditAssetDebtInfo(self, remain_amount: float, error_info: XTPRspInfoStruct, request_id: int, session_id: int)->None:
        ...
    def OnQueryCreditTickerAssignInfo(self, assign_info: XTPClientQueryCrdPositionStkInfo, error_info: XTPRspInfoStruct, request_id: int, is_last: bool, session_id: int)->None:
        ...
    def OnQueryCreditExcessStock(self, stock_info: XTPClientQueryCrdSurplusStkRspInfo, error_info: XTPRspInfoStruct, request_id: int, session_id: int)->None:
        ...
class TraderApi():
    
    
    
    
    @staticmethod
    def CreateTraderApi(client_id: int, save_file_path: str, log_level: XTP_LOG_LEVEL)->XTP.API.TraderApi:
        ...
    def Release(self, )->None:
        ...
    def GetTradingDay(self, )->str:
        ...
    def RegisterSpi(self, spi: XTP.API.TraderSpi)->None:
        ...
    def GetApiLastError(self, )->XTPRspInfoStruct:
        ...
    def GetApiVersion(self, )->str:
        ...
    def GetClientIDByXTPID(self, order_xtp_id: int)->int:
        ...
    def GetAccountByXTPID(self, order_xtp_id: int)->str:
        ...
    def SubscribePublicTopic(self, resume_type: XTP_TE_RESUME_TYPE)->None:
        ...
    def SetSoftwareVersion(self, version: str)->None:
        ...
    def SetSoftwareKey(self, key: str)->None:
        ...
    def SetHeartBeatInterval(self, interval: int)->None:
        ...
    def Login(self, ip: str, port: int, user: str, password: str, sock_type: XTP_PROTOCOL_TYPE)->int:
        ...
    def Logout(self, session_id: int)->int:
        ...
    def InsertOrder(self, order: XTPOrderInsertInfo, session_id: int)->int:
        ...
    def CancelOrder(self, order_xtp_id: int, session_id: int)->int:
        ...
    def QueryOrderByXTPID(self, order_xtp_id: int, session_id: int, request_id: int)->int:
        ...
    def QueryOrders(self, query_param: XTPQueryOrderReq, session_id: int, request_id: int)->int:
        ...
    def QueryTradesByXTPID(self, order_xtp_id: int, session_id: int, request_id: int)->int:
        ...
    def QueryTrades(self, query_param: XTPQueryTraderReq, session_id: int, request_id: int)->int:
        ...
    def QueryPosition(self, ticker: str, session_id: int, request_id: int)->int:
        ...
    def QueryAsset(self, session_id: int, request_id: int)->int:
        ...
    def QueryStructuredFund(self, query_param: XTPQueryStructuredFundInfoReq, session_id: int, request_id: int)->int:
        ...
    def FundTransfer(self, fund_transfer: XTPFundTransferReq, session_id: int)->int:
        ...
    def QueryFundTransfer(self, query_param: XTPQueryFundTransferLogReq, session_id: int, request_id: int)->int:
        ...
    def QueryETF(self, query_param: XTPQueryETFBaseReq, session_id: int, request_id: int)->int:
        ...
    def QueryETFTickerBasket(self, query_param: XTPQueryETFComponentReq, session_id: int, request_id: int)->int:
        ...
    def QueryIPOInfoList(self, session_id: int, request_id: int)->int:
        ...
    def QueryIPOQuotaInfo(self, session_id: int, request_id: int)->int:
        ...
    def QueryOptionAuctionInfo(self, query_param: XTPQueryOptionAuctionInfoReq, session_id: int, request_id: int)->int:
        ...
    def CreditCashRepay(self, amount: float, session_id: int)->int:
        ...
    def QueryCreditCashRepayInfo(self, session_id: int, request_id: int)->int:
        ...
    def QueryCreditFundInfo(self, session_id: int, request_id: int)->int:
        ...
    def QueryCreditDebtInfo(self, session_id: int, request_id: int)->int:
        ...
    def QueryCreditTickerDebtInfo(self, query_param: XTPClientQueryCrdDebtStockReq, session_id: int, request_id: int)->int:
        ...
    def QueryCreditAssetDebtInfo(self, session_id: int, request_id: int)->int:
        ...
    def QueryCreditTickerAssignInfo(self, query_param: XTPClientQueryCrdPositionStockReq, session_id: int, request_id: int)->int:
        ...
    def QueryCreditExcessStock(self, query_param: XTPClientQueryCrdSurplusStkReqInfo, session_id: int, request_id: int)->int:
        ...
class QuoteSpi():
    
    
    
    
    def OnDisconnected(self, reason: int)->None:
        ...
    def OnError(self, error_info: XTPRspInfoStruct)->None:
        ...
    def OnSubMarketData(self, ticker: XTPSpecificTickerStruct, error_info: XTPRspInfoStruct, is_last: bool)->None:
        ...
    def OnUnSubMarketData(self, ticker: XTPSpecificTickerStruct, error_info: XTPRspInfoStruct, is_last: bool)->None:
        ...
    def OnDepthMarketData(self, market_data: XTPMarketDataStruct, bid1_qty: List[int], bid1_count: int, max_bid1_count: int, ask1_qty: List[int], ask1_count: int, max_ask1_count: int)->None:
        ...
    def OnSubOrderBook(self, ticker: XTPSpecificTickerStruct, error_info: XTPRspInfoStruct, is_last: bool)->None:
        ...
    def OnUnSubOrderBook(self, ticker: XTPSpecificTickerStruct, error_info: XTPRspInfoStruct, is_last: bool)->None:
        ...
    def OnOrderBook(self, order_book: OrderBookStruct)->None:
        ...
    def OnSubTickByTick(self, ticker: XTPSpecificTickerStruct, error_info: XTPRspInfoStruct, is_last: bool)->None:
        ...
    def OnUnSubTickByTick(self, ticker: XTPSpecificTickerStruct, error_info: XTPRspInfoStruct, is_last: bool)->None:
        ...
    def OnTickByTick(self, tbt_data: XTPTickByTickStruct)->None:
        ...
    def OnSubscribeAllMarketData(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->None:
        ...
    def OnUnSubscribeAllMarketData(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->None:
        ...
    def OnSubscribeAllOrderBook(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->None:
        ...
    def OnUnSubscribeAllOrderBook(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->None:
        ...
    def OnSubscribeAllTickByTick(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->None:
        ...
    def OnUnSubscribeAllTickByTick(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->None:
        ...
    def OnQueryAllTickers(self, ticker_info: XTPQuoteStaticInfo, error_info: XTPRspInfoStruct, is_last: bool)->None:
        ...
    def OnQueryTickersPriceInfo(self, ticker_info: XTPTickerPriceInfo, error_info: XTPRspInfoStruct, is_last: bool)->None:
        ...
    def OnSubscribeAllOptionMarketData(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->None:
        ...
    def OnUnSubscribeAllOptionMarketData(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->None:
        ...
    def OnSubscribeAllOptionOrderBook(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->None:
        ...
    def OnUnSubscribeAllOptionOrderBook(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->None:
        ...
    def OnSubscribeAllOptionTickByTick(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->None:
        ...
    def OnUnSubscribeAllOptionTickByTick(self, exchange_id: XTP_EXCHANGE_TYPE, error_info: XTPRspInfoStruct)->None:
        ...
class QuoteApi():
    
    
    
    
    @staticmethod
    def CreateQuoteApi(client_id: int, save_file_path: str, log_level: XTP_LOG_LEVEL)->XTP.API.QuoteApi:
        ...
    def Release(self, )->None:
        ...
    def GetTradingDay(self, )->str:
        ...
    def GetApiVersion(self, )->str:
        ...
    def GetApiLastError(self, )->XTPRspInfoStruct:
        ...
    def SetUDPBufferSize(self, buff_size: int)->None:
        ...
    def RegisterSpi(self, spi: XTP.API.QuoteSpi)->None:
        ...
    def SetHeartBeatInterval(self, interval: int)->None:
        ...
    def SubscribeMarketData(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def UnSubscribeMarketData(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def SubscribeOrderBook(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def UnSubscribeOrderBook(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def SubscribeTickByTick(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def UnSubscribeTickByTick(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def SubscribeAllMarketData(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def UnSubscribeAllMarketData(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def SubscribeAllOrderBook(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def UnSubscribeAllOrderBook(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def SubscribeAllTickByTick(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def UnSubscribeAllTickByTick(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def Login(self, ip: str, port: int, user: str, password: str, sock_type: XTP_PROTOCOL_TYPE)->int:
        ...
    def Logout(self, )->int:
        ...
    def QueryAllTickers(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def QueryTickersPriceInfo(self, ticker: List[str], exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def QueryAllTickersPriceInfo(self, )->int:
        ...
    def SubscribeAllOptionMarketData(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def UnSubscribeAllOptionMarketData(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def SubscribeAllOptionOrderBook(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def UnSubscribeAllOptionOrderBook(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def SubscribeAllOptionTickByTick(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...
    def UnSubscribeAllOptionTickByTick(self, exchange_id: XTP_EXCHANGE_TYPE)->int:
        ...

